﻿
using Mal.Balades.AdminBusiness.DataAccess;
using System.ServiceModel;
using System.Collections.ObjectModel;
using Mal.Balades.AdminBusiness.DataModel;
using mal.balades.Business.Log;
using System.ServiceModel.Activation;

namespace mal.balades.Web.Administration
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "AdminService" in code, svc and config file together.
     [AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
    public class AdminService : IAdminService
    {
        #region Fields
        private AdminDataAccess dataAccess;
        #endregion

        #region Construction / Destruction
            public AdminService()
            {
                dataAccess = new AdminDataAccess();
            }
        #endregion

        #region OperationContract
        
        public ReadOnlyCollection<VisitDashboard> GetVisitsForDashboard()
        {
            MalLogManager.WebLogger.Info("");
            ReadOnlyCollection<VisitDashboard> results = dataAccess.GetVisitsForDashboard();

            return results;
        }

       
        public VisitAdmin GetVisit(int visitId)
        {
            MalLogManager.WebLogger.InfoFormat("visitId:{0}", visitId);
            VisitAdmin result = dataAccess.GetVisit(visitId);

            return result;
        }

        
        public ReadOnlyCollection<Mal.Balades.AdminBusiness.DataModel.Picture> GetVisitPictures(int visitId)
        {
            MalLogManager.WebLogger.InfoFormat("visitId:{0}", visitId);
            ReadOnlyCollection<Mal.Balades.AdminBusiness.DataModel.Picture> results = dataAccess.GetVisitPictures(visitId);

            return results;
        }

       
        public ReadOnlyCollection<Mal.Balades.AdminBusiness.DataModel.Information> GetVisitInformations(int visitId)
        {
            MalLogManager.WebLogger.InfoFormat("visitId:{0}", visitId);
            ReadOnlyCollection<Mal.Balades.AdminBusiness.DataModel.Information> results = dataAccess.GetVisitInformations(visitId);

            return results;
        }

       
        public SaveVisitResult SaveVisit(SaveVisitObject visitToSave)
        {
            MalLogManager.WebLogger.Info("");
            SaveVisitResult result = dataAccess.SaveVisit(visitToSave);
            return result;
        }
        #endregion
    }
}
